<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue</title>
    <script src="js/vue-2.6.12.js"></script>
</head>

<body>

    <div id="app">
        <input type="text" v-model="message">
        {{message}}
        <input type="button" value="点我一下" @click="handle()">
        <div v-for="addr in addrs">{{addr}}</div>
        <div v-for="(addr,index) in addrs">{{index}}:{{addr}}</div>

        <table border="1" cellspacing="0" width="60%">
            <tr>
                <th>编号</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>年龄</th>
                <th>年龄</th>
                <th>等级</th>

            </tr>
            <tr align="center" v-for="(user,index) in users">
                <td>{{index + 1}}</td>
                <td>{{user.name}}</td>
                <td>{{user.age}}</td>
                <td>
                    <span v-if="user.gender == 1">男</span>
                    <span v-if="user.gender == 2">女</span>
                </td>
                <td>{{user.score}}</td>
                <td>
                    <span v-if="user.score >=85">优秀</span>
                    <span v-else-if="user.score >= 60">及格</span>
                    <span style="color:red" v-else>不及格</span>
                </td>
            </tr>
        </table>
    </div>
</body>

<script>
    new Vue({
        el: '#app',
        data: {
            message: "Hello Vue!",
            addrs: ['北京', '上海', '广州', '深圳', '杭州', '成都'],
            users: [{
                    name: '张三',
                    age: 21,
                    gender: 1,
                    score: 78
                },
                {
                    name: '李四',
                    age: 22,
                    gender: '1',
                    score: 68
                },
                {
                    name: '王五',
                    age: 23,
                    gender: 2,
                    score: 83
                },
                {
                    name: '赵六',
                    age: 24,
                    gender: 1,
                    score: 55
                },
                {
                    name: '田七',
                    age: 25,
                    gender: 2,
                    score: 92
                },
            ],
        },
        methods: {
            handle() {
                alert("你点了我一下!")
            }
        },
    })
</script>

</html>